home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Celestin Apprentice 5
/
Apprentice-Release5.iso
/
Information
/
THINK C Digest
/
1992
/
92-10
< prev
next >
Wrap
Text File
|
1995-12-31
|
101KB
|
3,063 lines
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: stdio and keyDown events
Message-ID: <9210011304.AA00164@chaos.cs.brandeis.edu>
In-Reply-To: Tom Luhrs's message of 30 Sep 92 18:40:47 GMT <9209301249.AA08639@elm.sanders.lockheed.com>
Newsgroups: fa.think-c
Lines: 20
Date: 1 Oct 92 13:04:46 GMT
Here is the proper invocation:
DCtlHandle dceH;
Init(); /* Initialize toolbox first */
printf("\n"); /* Initialize & install console driver */
/* get stdout's device control entry handle */
dceH = UTableBase [~ ((WindowPeek) stdout->window)->windowKind];
/* modify its event mask, so it doesn't try to handle keydowns */
(**dceH).dCtlEMask &= ~keyDownMask;
The name "UTableBase" is low memory global, so the above code will
only work if you're #including <LoMem.h> or <MacHeaders>.
-phil
----
Phil Shapiro Software Engineer
Language Products Group Symantec Corporation
Internet: phils@cs.brandeis.edu
Path: ucivax!gateway
From: 100015.424@compuserve.com (Stephan Mayr)
Subject: Number Formatting?
Message-ID: <921001191715_100015.424_EHF35-1@CompuServe.COM>
Newsgroups: fa.think-c
Lines: 9
Date: 1 Oct 92 19:24:31 GMT
I would like to format numbers using the toolbox functions "Str2Format",
"Format2Str", "FormatX2Str" and "FormatStr2X" (Reference: IM, VI 14-49), but I
cannot find the parameter description for these functions.
I guess its contained in "WorldWide Software Development", but I do not own
that book and it takes to long to order from europe, seems they are producing a
revised version, because it doesn't show up in my "Addison Wesley" catalog.
I would be glad about any info and example code. Thanks, Stephan
Path: ucivax!gateway
From: P30WCC9%NIU.bitnet@uicvm.uic.edu (WES COVALT)
Subject: Unpacking MacPaint Solved
Message-ID: <9210011326.aa18185@Paris.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 7
Date: 1 Oct 92 20:33:44 GMT
The problem was in the use of GWorld routines in System 6.07.
Mac Programing Secrets used:
destPtr = GetPixBaseAddr( GetGWorldPixMap( buffer ));
Though I got the baseAddr directly, I found that this works best:
destPtr = GetPixBaseAddr( (*buffer).portPixMap );
Many thanks to those patient souls for the help.
Path: ucivax!gateway
From: kw27+@andrew.cmu.edu (Kip Walker)
Subject: Heap woes....
Message-ID: <oemrt9u00Uzx85j1J4@andrew.cmu.edu>
Newsgroups: fa.think-c
Lines: 20
Date: 1 Oct 92 22:40:40 GMT
In a little program I'm working on, I'm trying to allocate memory for an
offscreen pixmap. I have called MoreMasters and MaxApplZone, and
checked my heap before the NewPtr - I have 500K free, and am trying to
get only 32K. - and the heap has only 900 or so bytes used
non-relocatably.
After the NewPtr call, I get the pointer, but my heap has been eaten -
now it shows a HUGE 300K nonrelocatable block in use.
anyone have ideas about the cause of this?
Thanks in advance folks...
Kip Walker
----------------------------+
kwalker+@cmu.edu | "Here's your I.D.,
kw27+@andrew.cmu.edu | ideal for identifying one and all."
kip@drycas.club.cc.cmu.edu | -Jethro Tull
Path: ucivax!gateway
From: MRUHL@azcc.arizona.edu (The sky is ecstasy dancing)
Subject: Thanks.
Message-ID: <921001170250.29400b91@AZCC.Arizona.EDU>
Newsgroups: fa.think-c
Lines: 31
Date: 2 Oct 92 00:03:12 GMT
X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
Well, I found out what my problem with integers was. :)
If I choose to use the 4 byte int option, I must recompile the ansi library, in
order for the fucntions to work in the way that I assumed. I haven't had a
chance to sit down and do this yet, but I will, and then maybe I will post how
it is to be done. :)
Thanks again,
especially to:
Danny Thomas
R. Siegel
Chris Page
Eric from p3.lnal.gov
David 'Dak' Keldsen
Paul Franklin
Josh Cherry
Hugues Marty
Bill Hofmann
David Dantowitz
Eroc Slosser.
Mike
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Mike Ruhl
Operator
Arizona Cancer Center
mruhl@azcc.arizona.edu
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: stdio and keyDown events
Message-ID: <9210020132.AA20690@netcom.com>
Newsgroups: fa.think-c
Lines: 5
Date: 2 Oct 92 01:36:07 GMT
Yes, Phil.... Think C should include sprintf in either MacTraps or MacTraps2.
Another possibility would be to provide a compilable source for sprintf so
we could include it. Maybe you already do this; if so, where can I find it?
(Note: use of sprintf in a mac application may not be localizable.)
Path: ucivax!gateway
From: ejohnson@suna0.cs.uiuc.edu (Eric E Johnson)
Subject: Looking for sample code for ASR's in MacTCP
Message-ID: <199210020330.AA01029@sparc3.cs.uiuc.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 27
Date: 2 Oct 92 03:29:52 GMT
I've been working on a networked, role playing game for the Mac using
Think C. To make the networking easier, I'm using a MacTCP class that I
picked up from the Think Class Library email list. Unfortunately, I've
hit a terrible road block, not with the class, but with MacTCP itself,
and possibly Think C.
MacTCP provides two notification methods, one is the ASR, the other is
the asynchronous completion routine. I've been unsuccessful in using
either one separately or combined. I won't bore you with the details.
But I can say that my problem was not that they never got called, but
that after awhile, when the networking between the server and client
would go up to speed, the Mac would die.
I'm looking for some sample Think C code that demonstrates either one or
both of these notification methods in detail. By that, I mean issuing
other MacTCP calls that have notification methods as well. I've been
using the MacTCP docs from Apple, but there is no demo code in there for
how to deal with lots of completion routines.
I don't have direct access to the "Developer" CD Roms, but would anyone
know if they have any demo code for some elaborate call back schemes?
Eric
Path: ucivax!gateway
From: dmorley@clam.rutgers.edu (darin s morley)
Subject: Code Optimazation Problem
Message-ID: <CMM-RU.1.3.718078210.dmorley@clam.rutgers.edu>
Newsgroups: fa.think-c
Lines: 38
Date: 3 Oct 92 02:10:19 GMT
I've noticed some strange behavior in the debugger when using code like the
following:
#define kDataType float
class FooBar
{
virtual kDataType Data();
virtual Boolean Bool();
}
main()
{
Boolean boolVar;
kDataType dataVar;
FooBar *myFooBar;
myFooBar = new FooBar;
boolVar = myFooBar->Bool();
dataVar = myFooBar->Data();
}
Watching the values of boolVar and dataVar, I noticed that boolVar was 1
before myFooBar->Data() was invoked. However, it became zero afterward. I
suspected a problem in the Data() method so I rewrote it:
kDataType FooBar::Data( void )
{
return (kDataType) 0;
}
... and then I ran it again only to have the same problem. Apparently, the
return value was the wrong size and was overwriting boolVar. I decided to
play with the option settings to see what effect that would have. I turned
"Native Floating Point Format" *off*, but that had no effect. I then turned
"Code Optimization" *off*, and everything worked fine! Has anyone else
noticed such anomalies when "Code Optimization" was on? Is there a known
bug in the optimizer? Have I overlooked something?
Path: ucivax!gateway
From: thein@seas.ucla.edu (Hla Tun "Tim" Thein)
Subject: unsubscribe me please
Message-ID: <9210031149.AA1512574@curtiss.seas.ucla.edu>
Newsgroups: fa.think-c
Lines: 1
Date: 3 Oct 92 11:49:25 GMT
Please cancel my subscription.
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: Code Optimazation Problem
Message-ID: <9210031403.AA23812@chaos.cs.brandeis.edu>
In-Reply-To: darin s morley's message of 3 Oct 92 02:10:19 GMT <CMM-RU.1.3.718078210.dmorley@clam.rutgers.edu>
Newsgroups: fa.think-c
Lines: 67
Date: 3 Oct 92 14:03:30 GMT
[ Register map coloring strikes again! Read below for details if you
haven't heard of this problem before. ]
>>>>> On 3 Oct 92 02:10:19 GMT, darin s morley <dmorley@clam.rutgers.edu> said:
> I've noticed some strange behavior in the debugger when using code
> like the following:
> #define kDataType float
> class FooBar
> {
> virtual kDataType Data();
> virtual Boolean Bool();
> }
> main()
> {
> Boolean boolVar;
> kDataType dataVar;
> FooBar *myFooBar;
> myFooBar = new FooBar;
> boolVar = myFooBar->Bool();
> dataVar = myFooBar->Data();
> }
> Watching the values of boolVar and dataVar, I noticed that boolVar
> was 1 before myFooBar->Data() was invoked. However, it became zero
> afterward. I suspected a problem in the Data() method so I rewrote
> it:
> kDataType FooBar::Data( void )
> {
> return (kDataType) 0;
> }
> ... and then I ran it again only to have the same problem.
> Apparently, the return value was the wrong size and was overwriting
> boolVar. I decided to play with the option settings to see what
> effect that would have. I turned "Native Floating Point Format"
> *off*, but that had no effect. I then turned "Code Optimization"
> *off*, and everything worked fine! Has anyone else noticed such
> anomalies when "Code Optimization" was on? Is there a known bug in
> the optimizer? Have I overlooked something?
The problem that you're running into is caused by using the debugger
with optimized code; the code is correct (and will run fine), but the
debugger displays incorrect results for some local variables.
This caused by the "register coloring" (or map coloring) optimization.
It examines your code, and determines the lifetime of all variables
(and temporaries) in a particular scope, and places variables whose
lives don't overlap into the same register (or stack temporary). In
your example above, the local variable "boolVar" was no longer needed
after it was assigned to, so the compiler placed it and "dataVar" in
the same retgister. When dataVar's value changed, boolVar's did as
well.
As the User Manual recommends, the optimizer shouldn't be enabled when
you're using the debugger, except in rare cases when optimized code
exhibits behavior that non-opimized code does not.
-phil
----
Phil Shapiro Software Engineer
Language Products Group Symantec Corporation
Internet: phils@cs.brandeis.edu
Path: ucivax!gateway
From: Rich_Watts@dgc.ceo.dg.com
Subject: ANSI putc()
Message-ID: <9210041711.AB00107@rtp41.rtp.dg.com>
Newsgroups: fa.think-c
Lines: 8
Date: 4 Oct 92 16:13:34 GMT
HELP!!!
Why doesn't this work!
.
if (putc(nodes[i].count, output->file) != (int)nodes[i].count);
Path: ucivax!gateway
From: jimlynch@netcom.com (Jim Lynch)
Subject: Re: ANSI putc()
Message-ID: <9210041856.AA24301@netcom2.netcom.com>
Newsgroups: fa.think-c
Lines: 14
Date: 4 Oct 92 18:57:18 GMT
You have to be MUCH more specific than "Why doesn't this work?".
What compiler? What mac system version (_probably_ irrelevant)?
More important: What do you want it to do? What is the behavior from which
you draw the conclusion that the code doesn't work?
Otherwise, I'm out in left field (or is it right field?) and I have no idea
what the answer (or even the question) is.
Rich, I post to you personally because you sent the original question and I
post to the net as a courtesy reminder.
-Jim (jimlynch@netcom.com)
Path: ucivax!gateway
From: igorl@uiuc.edu (Igor Livshits)
Subject: Icon families
Message-ID: <9210052340.AA10431@newton.ncsa.uiuc.edu>
Newsgroups: fa.think-c
Lines: 12
Date: 5 Oct 92 23:40:42 GMT
Hello,
I am befuddled: Is there a call that will fetch a handle to an icon family?
IM VI clearly states that a Notification Manager record will take either a
handle to a SICN resource or a handle to an icon family. Unfortunately, I
have only seen examples with small icons. If someone has successfully sent
a color icon to the Notification Manager, please tell me how...
Many thanks, igor
Path: ucivax!gateway
From: jpff@maths.bath.ac.uk
Subject: Floating point problems
Via: uk.ac.bath.maths; Tue, 6 Oct 1992 10:45:11 +0100
Message-ID: <9210060245.aa11081@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 22
Date: 6 Oct 92 09:45:41 GMT
Message written at Sun Oct 4 17:10:24 BST 1992
We seem to have a problem which has been defeating me and colleagues for
some weeks.
We have a reasonably large C program we have ported to various
machines, but on the MAC it gives trouble. The symptom is only in
floating point. I am working with 8 bytes doubles/4 byte ints, and I
have recompiled all the libraries with that option. The problem is
inside atof, which calls all kinds of things, but eventually deep in
scanf it calls fp68k from dtof; fp68k seems to be a bit of inline
assembler. The second call to fp68K, with arguments
fp68k(d, p, FOD2B + code)
bombs at 0x000340ee
I do not understand what it is trying to do at this point, so
deciding why it bombs seems rather hard!
Any suggestions would be appreciated.
==John
PS: We did have a very short program which just called atof which
collapsed, but with all the fiddling that seems to work now.
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: >32k TextEdit
Message-ID: <01GPMJ4QDQTE8WW772@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 3
Date: 6 Oct 92 14:43:37 GMT
X-Envelope-to: think-c@ics.uci.edu
someone was asking for a class that supported >32k TextEditish stuff.
was this ever found?
Path: ucivax!gateway
From: KFISCHER@arac.llnl.gov (Kathleen Fischer)
Subject: CPaneBorder (in color)
Message-ID: <01GPMJ8S5BK0000AES@addvax.llnl.gov>
Newsgroups: fa.think-c
X-VMS-To: ADDVAX::IN%"think-c@ics.uci.EDU"
Lines: 5
Date: 6 Oct 92 17:46:55 GMT
X-Envelope-to: think-c@ics.uci.EDU
Has anyone created a Color/GrayScale version of CPaneBorder that they would
be willing to share? Pleaaaaaaaassssee :^)
Kathleen
kfischer@arac.llnl.gov
Path: ucivax!gateway
From: igorl@uiuc.edu (Igor Livshits)
Subject: Icon families
Message-ID: <9210061845.AA05287@newton.ncsa.uiuc.edu>
Newsgroups: fa.think-c
Lines: 19
Date: 6 Oct 92 18:45:58 GMT
Thank you to all who suggested TN 306 for icon families: everything works
great!
There is one problem with the C glue in the tech note.
Prototypes for for the following:
pascal OSErr ForEachIconDo(Handle theSuite,long selector,ProcPtr
action,void *yourDataPtr)
= {0x303C, 0x080A, 0xABC9};
pascal OSErr GetIconSuite(Handle *theIconSuite,short theResID,long
selector)= {0x303C, 0x0501, 0xABC9};
Should have long for selector, NOT short as is in the tech note. Keeping
it short causes a nasty bus error!
Igor
Path: ucivax!gateway
From: gb2a+@andrew.cmu.edu ("George J. Baxter")
Subject: Think C bug report
Message-ID: <IeoSWdW00Uh_M5IV0q@andrew.cmu.edu>
Newsgroups: fa.think-c
Lines: 57
Date: 6 Oct 92 19:28:48 GMT
Howdy..
I have program, written in THINK C 5.0.3 (recent update). My
routine USED to work.. the problem is arising when I want to copy the
first 'word' of a string into another string:
while (*longString != ' ' && longString != (comLine + (long)(comLine[0]+1L)))
firstWord[i++] = *longString++;
firstWord[i]=0;
(Basically, comLine is a pascal string, and longString is a character
pointer initially pointing to the first character after comLine[0], ie,
comLine[1]. I want firstWord as a 'C' string).
What occurs in the last line of the code fragment is that
'firstWord[i]=0' actually does this:
firstWord[0]=0;
ie, it nukes my string. In the debugger, everything is cool.. 'i' is
the correct digit (it's a short), the array is unchanged. When I put a
DebugStr in right before the firstWord[i]=0, it WORKS.. so I took a look
at the assembly in MacsBug and this is what is happening.
Without the debugstr, ie, when the code doesn't work, a2 gets initialized to
-$28(a6,d3.W), which is the beginning of the string.. ie, firstWord[0].
d3 is 'i', which at the beginning, is 0. The firstWord[i]=0 assignment
is CLR.b (A2)... which is WRONG!!! Inside MacsBug, I can see my word is
ok, then the first character gets nuked by the 'CLR.b (a2)' statement.
With the debugstr, it doesn't use A2... and the CLR.b is
CLR.b -$28(a6,d3.W)
and d3, at this point, is the correct short value for the end of the
string, so the code works.
Hmmmmm.
I tried a work around also.. using a char *dummy:
dummy = firstWord+long(i);
*dummy = 0;
and basically, the statement totally ignored the (long)i, both in the
Think Debugger and in the assembly code. To get it to work, I had to:
dummy = firstWord;
dummy += firstWord;
*dummy = 0;
-George Baxter
-----------------------
gb2a@andrew.cmu.edu baxter@a.cfr.cmu.edu
"Only a Hawaiian can say Humuhumunukunukuapuaa five times fast, correctly."
"I think we're in for a bad spell of wether."
Path: ucivax!gateway
From: de19@umail.umd.edu (Dana S Emery)
Subject: Re: >32k TextEdit
Message-ID: <Mailstrom.1.03b2.42359.15089.de19@umail.umd.edu>
In-Reply-To: Your message <01GPMJ4QDQTE8WW772@TOE.TOWSON.EDU> of 6 Oct 92
14:43:37 GMT
Content-Type: TEXT/plain; charset=US-ASCII
Newsgroups: fa.think-c
Lines: 26
Date: 7 Oct 92 00:20:19 GMT
while not an exact substitute, CPEditText may suit your needs.
anaonymous ftp from
ftp.brown.edu/pub/tcl/classes
I am working with it now.
It does not support 'wrap-to-frame' (TE line width of -1), although one could
subclass it and mirror frame size change to a change in line width, I suspect
that this would be expensive (time wise) for long files, as it forces a complete
redetermination of line break.
Also not supported is multistyed text, although I suspect that one could
subclass that as a summer long project.
Parameterized fixed width Tabs are supported, tho the UI is left up to you.
From what I have seen of it, the code quality is good, and comments are targeted
to an experienced tcl audience, they are not tutorial.
--
dana s emery <de19@umail.umd.edu>
Path: ucivax!gateway
From: cdrivett@teaching.cs.adelaide.edu.au (CD RIVETT)
Subject: random numbers
Message-ID: <9210080847.AA04952@brian.teaching.cs.adelaide.edu.au>
X-Mailer: ELM [version 2.4dev PL52]
Newsgroups: fa.think-c
Lines: 9
Date: 8 Oct 92 08:47:35 GMT
Dear all,
I don't know if this is a faq but can any one shed
light on the problem of getting random numbers (not using the
ANSI rand calls as this is not random! It will yeild the
same result every time you run it).Also does any one have any
ideas abouyt how to do a random selectiion from a fixed set of
elements WITHOUT resplacement.
Thanks
Terry Hannant
Path: ucivax!gateway
From: CORMACK@psyvax.psy.utexas.edu
Subject: Re: random numbers
Message-ID: <9210080529.aa06095@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 30
Date: 8 Oct 92 12:29:32 GMT
Hey,
CD Rivett writes:
>light on the problem of getting random numbers (not using the
>ANSI rand calls as this is not random! It will yeild the
>same result every time you run it).Also does any one have any
No "random" number generator is; they all produce psuedo-random
sequences of numbers. Given the same seed, they will produce they
same sequence every time. This is actually an advantage most of the
time.
Reseeding the random number generator with srand() before each
call to rand() with, say, the number of seconds elapsed since midnight
usually works well (unless you run you code at *exactly* the same time
each day!).
Definitely consult "Numerical Recipies in C" for an excellent discussion
of random # generators and code for various portable random # generators.
-Larry
---------------------------------------------------------------
Lawrence K. Cormack | cormack@psyvax.psy.utexas.edu
Department of Psychology | w: (512) 471-3358
U.T. Austin | h: (512) 873-9464
Path: ucivax!gateway
From: alan@kaman.com (Alan Piszcz)
Subject: MORE INFO ON Re: random numbers
Message-ID: <9210081326.AA01368@p1.kaman.com>
Newsgroups: fa.think-c
Lines: 50
Date: 8 Oct 92 13:26:31 GMT
cat t1
Date: Thu, 30 Jul 92 19:50:13 CDT
From: PC0TMYS <PC0TMYS%MUSIC.TCS.TULANE.EDU@VM.TCS.Tulane.EDU>
Subject: [*] ultra101.hqx (math: random number generator)
Arif Zaman and George Marsaglia of the Supercomputer Computations
Research Institute at Florida State University recently developed a
random number generator that has special features. They wrote an
IBM/PC implementation of it in assembler and C, called ULTRA101.ZIP,
which they uploaded to the network.
I downloaded that file and converted their C program to run on the
macintosh. I am submitting a Stuffit 1.5.1 archive containing this
conversion and also the original IBM submission. I don't know in which
directory this should be placed. Maybe, app or lang. It would be nice
to have a "math" directory to put it in.
I read about their program from the listserver PCTECH-L@TREARN
when Jim Ritterbusch sent the following message on April 13, which
I will quote:
A while ago, I sent a message searching for a random number generator that
was a recent development in that it had a humongous period. A few of you
replied directly expressing interest when and if I was able to get the
information.
I have finally located it. I replied directly to those that asked, but in
case any others of you are still lurking and waiting for the answer, here
it is.
It was developed by Arif Zaman and George Marsaglia of the Supercomputer
Computations Research Institute at Florida State University. It has a
period of over 10^356 (or about 10^250 random numbers for each atom in
the universe !).
An IBM/PC version including source code for assembler and C is available
as the file ULTRA101.ZIP. I was able to anonymous ftp this from
garbo.uwasa.fi iy to let it run at full speed (for instance
when it is connected to the charger) without having to mess with extensions
and/or controlpanels every time I switch from 'connected to wall-outlet' to
'running on battery'?
Any help would be appreciated...
Regards,
Adam van Gaalen ( adam@igg.tno.nl)
or (pa2aga@igg.tno.nl)
p1.kaman.com:/home/guppy/alan_21 %
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: tcl address
Message-ID: <01GPPBKF73CY8WWF7P@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 2
Date: 8 Oct 92 14:43:02 GMT
X-Envelope-to: think-c@ics.uci.edu
i know, i should have noted one of the thirty times it was posted.
anyway: what is the address for the tcl discussion list?
Path: ucivax!gateway
From: SCHENKL@vax.cs.hscsyr.edu
Subject: Installing time manager tasks at startup
Message-ID: <921008202533.208012ca@vax.cs.hscsyr.edu>
Newsgroups: fa.think-c
Lines: 9
Date: 9 Oct 92 00:29:52 GMT
X-Vmsmail-To: SMTP%"think-c@ics.uci.edu"
Any information/hints/things to be aware of on installing a task that will
run at say, every 30 minutes, after booting up?
I have a INIT, that I have detached the resource and it is in the system
heap, but when I try something like "InsTime" and "PrimeTime" it doesn't
seem to work. Anyone know?
I'll post the code if anybody thinks that that would help.
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: ADmodule vs. Word 5.0
Message-ID: <01GPPQ9NXK9U8WWGU8@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 5
Date: 9 Oct 92 02:01:55 GMT
X-Envelope-to: think-c@ics.uci.edu
I wrote an after dark module that does fine until i leave it and
word is running. besides sympathy i'd like some leads on how to track
down a problem like this.
aaron
Path: ucivax!gateway
From: pchang@cs.stanford.edu (The Weasel)
Subject: Re: random numbers
Message-ID: <9210090516.AA04337@Xenon.Stanford.EDU>
In-Reply-To: <9210080529.aa06095@q2.ics.uci.edu>; from "CORMACK@psyvax.psy.utexas.edu" at Oct 8, 92 12:29 pm
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 34
Date: 9 Oct 92 05:16:56 GMT
CORMACK@psyvax.psy.utexas.edu writes:
>
> Hey,
>
> CD Rivett writes:
> >light on the problem of getting random numbers (not using the
> >ANSI rand calls as this is not random! It will yeild the
> >same result every time you run it).Also does any one have any
>
> No "random" number generator is; they all produce psuedo-random
> sequences of numbers. Given the same seed, they will produce they
> same sequence every time. This is actually an advantage most of the
> time.
>
> Reseeding the random number generator with srand() before each
> call to rand() with, say, the number of seconds elapsed since midnight
> usually works well (unless you run you code at *exactly* the same time
> each day!).
Actuallyou should seed the random number generator once when initializing
your application, and then you should not need to worry about it again. I
remember discussing this in one of my simulation classes, and seeding it
over and over may possibly produ poor results depending on where you are
getting the seed values from.
I often use GetDateTime(&randSeed); in my initialization phase, and then
make calls to the Toolbox Random() when I need a random number. The bonus
of using one call to seed is that if you need to repeat a stream of "random"
numbers al you have to do is start with the same seed.
I hope this helps.
Peter
Path: ucivax!gateway
From: de19@umail.umd.edu (Dana S Emery)
Subject: Re: random numbers
Message-ID: <Mailstrom.1.03b2.40038.19928.de19@umail.umd.edu>
In-Reply-To: Your message
<9210080847.AA04952@brian.teaching.cs.adelaide.edu.au> of 8 Oct 92 08:47:35
GMT
Content-Type: TEXT/plain; charset=US-ASCII
Newsgroups: fa.think-c
Lines: 16
Date: 9 Oct 92 06:18:08 GMT
> It will yeild the same result every time you run it).
a damn good thing, when you are debugging.
When you are in production mode, you are supposed to provide a varied seed. A
hash of the current time and the user name (or what ever else strikes your
fancy) serves for most of us, if you want to you could park the last seed, and
use it as the next seed.
Of course, you could always roll your own, look to CACM for more info, random
number generators are a popular subject, and several strategys exist, deciding
on one may be your hardest job.
--
dana s emery <de19@umail.umd.edu>
Path: ucivax!gateway
From: CORMACK@psyvax.psy.utexas.edu
Subject: Re: random numbers
Message-ID: <9210090539.aa08818@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 17
Date: 9 Oct 92 12:39:42 GMT
From "The Weasel:"
>Actuallyou should seed the random number generator once when initializing
>your application, and then you should not need to worry about it again. I
This is correct. Sorry for the mis-type in my original reply.
-Larry
---------------------------------------------------------------
Lawrence K. Cormack | cormack@psyvax.psy.utexas.edu
Department of Psychology | w: (512) 471-3358
U.T. Austin | h: (512) 873-9464
Path: ucivax!gateway
From: Scott_Howard@qms1.life.uiuc.edu (Scott Howard)
Subject: Writing to custom resources
Message-ID: <199210091351.AA27704@ux1.cso.uiuc.edu>
Return-Receipt-To: "Scott Howard" <Scott_Howard@qms1.life.uiuc.edu>
Newsgroups: fa.think-c
Lines: 11
Date: 9 Oct 92 13:51:59 GMT
REGARDING Writing to custom resources
I've just started programming on the Mac and haven't had the funds or luck to
get the Toolbox Utilities IM books, so please accept my apologies if this seems
like a lazy or stupid question:
How do you write into an open resource file? I made a custom resource type,
'PREF', ID 128. Thanks to some Apple DTS Code, I've managed to find the file on
the disk, open the resource, put a handle to it, lock it down, but want to
write two boolean variables to the file and save it.
Path: ucivax!gateway
From: macknik@uhunix.uhcc.hawaii.edu ("Elizabeth A. Macknik")
Subject: Random Numbers
Message-ID: <Pine.3.03.9210090314.A874-b100000@uhunix.uhcc.Hawaii.Edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mime-Version: 1.0
Newsgroups: fa.think-c
Lines: 36
Date: 9 Oct 92 13:59:27 GMT
To produce random numbers, I call the Toolbox function Random(). Random()
is seeded by the global randSeed. The best way to set randSeed is to
call GetDateTime(&randSeed). randSeed should only be set once. Random()
will produce a set of integer random numbers in the range -32767 to 32767.
(I'm not sure these are the exact values; check the Quickdraw chapter of
Inside Macintosh.)
If you use an identical seed value, you will get an identical series of
numbers from Random(). (Or any psuedo-random number generator.)
This is a good way to test your program, but remember to change the
seeding before you compile your production version.
GetDateTime() will set a fairly unique seed to begin the sequence of numbers.
Do not call GetDateTime() repeatedly or you will be seeding the random number
generator with a series of numbers that are fairly close together. This
can produce undesirable results. In a program I wrote to shuffle a deck
of cards, I reset the seed each time I wanted to shuffle the deck, but
just called Random() to decide which card would come next within the
shuffle routine.
To recap:
short myShort;
GetDateTime(&randSeed); // Seed random # generator with unique value
// Call only once. (randSeed is a Quickdraw
// global)
myShort = Random(); // Call every time you need a random number.
Elizabeth A. Macknik macknik@uhunix.uhcc.hawaii.edu
Computer Specialist, College of Education Voice (808) 956-6855
University of Hawaii FAX: (808) 956-4114
Path: ucivax!gateway
From: macknik@uhunix.uhcc.hawaii.edu ("Elizabeth A. Macknik")
Subject: Printing Projects within Think C
Message-ID: <Pine.3.03.9210090337.B874-a100000@uhunix.uhcc.Hawaii.Edu>
Content-Type: TEXT/PLAIN; charset=US-ASCII
Mime-Version: 1.0
Newsgroups: fa.think-c
Lines: 14
Date: 9 Oct 92 14:05:05 GMT
Has anyone produced a Think C add-on that will print all of the text files
associated with a given project? I would like to be able to designate a
previous print date and have all files with newer modification dates
be printed. I like to keep current printouts of my source code, but it
is difficult to keep track of which files have changed.
If no one has made such an add-on, how many of you would use such a program?
I may tackle it if there is enough interest.
Elizabeth A. Macknik macknik@uhunix.uhcc.hawaii.edu
Computer Specialist, College of Education Voice (808) 956-6855
University of Hawaii FAX: (808) 956-4114
Path: ucivax!gateway
From: jmh@cccr.bwh.harvard.edu (john m higgins)
Subject: (none)
Message-ID: <9210091534.AA29787@cccr.bwh.harvard.edu>
Newsgroups: fa.think-c
Lines: 22
Date: 9 Oct 92 15:40:56 GMT
I need some help controlling colors in pixel maps and maintaining color
fidelity when I copybits on and offscreen.
I draw a picture in a window, creating a custom color palette as I go. I
copybits this picture to an offscreen port for later use. When I
copybits from the offscreen port back to the window, the colors are screwed
up. For instance, if I draw a ramp from black to white to black using 254
grayscales, and I copy it offscreen and back, I lose 252 grayscales.
I make sure that my custom palette is the active palette of the current port
when I create the offscreen port. I have read that this should ensure that
my offscreen port has the right colors. It doesn't seem to.
Where do the colors go when I SetPalette and ActivatePalette? I have looked
in the (**portPixMap).pmTable, and they do not seem to have gone there.
Any suggestions would be greatly appreciated.
John Higgins
jmh@cccr.bwh.harvard.edu
Path: ucivax!gateway
From: nagel@ics.uci.edu (Mark Nagel)
Subject: ADMIN: bouncing mail
Message-ID: <2829.718652654@ics.uci.edu>
Newsgroups: fa.think-c
Reply-To: think-c-request@ics.uci.edu
Lines: 12
Date: 9 Oct 92 17:44:23 GMT
Just to let everyone know, the electronic mail system here at UCI is
configured to direct errors back to me, not the entire list.
Unfortunately, some brain-dead mail systems out there do not check
the mail envelope information, but rather examine the mail headers
to determine to whom to send error reports. This is incorrect behavior
that I can do little about (other than banning such sites from the
list). If you do get a bounced message as a result of posting
something to this list, please let me know so I can remove the
offending address from the list.
Thanks,
Mark
Path: ucivax!gateway
From: huff@mcclb0.med.nyu.edu ("Edward J. Huff")
Subject: RE: random numbers
Message-ID: <01GPQWG1RB8I000AIJ@MCCLB0.MED.NYU.EDU>
Content-transfer-encoding: 7BIT
Newsgroups: fa.think-c
Lines: 19
Date: 9 Oct 92 17:47:47 GMT
X-Envelope-to: think-c@ics.uci.edu
>CORMACK@psyvax.psy.utexas.edu writes:
>[...]
>I often use GetDateTime(&randSeed); in my initialization phase, and then
>make calls to the Toolbox Random() when I need a random number.
>[...]
>Peter
The toolbox random number generator is VERY substandard. Avoid it.
I read somewhere that the Sane random number generator is supposed
to be an implementation of the "minimal standard" described in
CACM a few years ago, and it probably is, but I do not know that for a
fact.
--
Edward J. Huff huff@mcclb0.med.nyu.edu (212)998-8465
Keck Laboratory for Biomolecular Imaging
NYU Chemistry Deptartment, 31 Washington Place, New York NY 10003
Path: ucivax!gateway
From: nagel@ics.uci.edu (Mark Nagel)
Subject: ADMIN: more mailer gotchas
Message-ID: <3225.718652992@ics.uci.edu>
Newsgroups: fa.think-c
Reply-To: nagel@ics.uci.edu
Lines: 10
Date: 9 Oct 92 17:50:03 GMT
I've noticed an increasing frequency of messages being sent to
think-c-request when they seem to be intended to go to the list.
This appears to be because the mailer 'reply' command is selecting
the wrong reply-to address. Please double-check to whom your
message is being sent before actually sending it. There may be a
day or two delay period if the message is sent to think-c-request
rather than think-c.
Thanks,
Mark
Path: ucivax!gateway
From: KDLEE@alex.stkate.edu
Subject: RE: random numbers
Message-ID: <921008084317.20235cc9@ALEX.STKATE.EDU>
Newsgroups: fa.think-c
Lines: 11
Date: 9 Oct 92 17:50:29 GMT
X-Vmsmail-To: SMTP%"fa.think-c-outbound-request@ics.uci.edu"
Terry,
The ansi library rand will give you a different set of numbers if you
set the seed differently each time. To do this get the current tickcount
and use it as the seed.
To do it without repeating numbers scale the random numbers to be integers
and use them as indexes into a boolean array that tells you whether the
number has already been used. If it is already used try random until you get
the first one that is not used.
Kevin Lee
Path: ucivax!gateway
From: KDLEE@alex.stkate.edu
Subject: Re: random numbers
Message-ID: <921008084613.20235cc9@ALEX.STKATE.EDU>
Newsgroups: fa.think-c
Lines: 7
Date: 9 Oct 92 17:51:00 GMT
X-Vmsmail-To: SMTP%"fa.think-c-outbound-request@ics.uci.edu"
>Reseeding the random number generator with srand() before each
>call to rand() with, say, the number of seconds elapsed since midnight
Actually, you should only do srand once when your program starts up.
From then on let rand handle updating the seed.
Kevin Lee
Path: ucivax!gateway
From: SCHENKL@vax.cs.hscsyr.edu
Subject: RE: random numbers
Message-ID: <921008152553.20800ea5@vax.cs.hscsyr.edu>
Newsgroups: fa.think-c
Lines: 14
Date: 9 Oct 92 18:03:54 GMT
X-Vmsmail-To: SMTP%"fa.think-c-outbound-request@ics.uci.edu"
If your program is a mac program, you could just make the call :
GetDateTime ( &randSeed );
Which would seed the "random" number generator with the current time, so
it will always be different. (I don't know about the ANSI library,
but I bet that they call the toolbox function "Random()" and the above
solution works well for that.)
About the second question: I think that you lost me on that one. Explain
it to me again (I'm a little dense) and maybe I could help you.
Will Schenk - Dumbest 15 year old on the net.
Path: ucivax!gateway
From: huff@mcclb0.med.nyu.edu ("Edward J. Huff")
Subject: Re: colors and pixmaps...
Message-ID: <01GPR8BO6S6Q000CQF@MCCLB0.MED.NYU.EDU>
Content-transfer-encoding: 7BIT
Newsgroups: fa.think-c
Lines: 94
Date: 9 Oct 92 23:27:48 GMT
X-Envelope-to: think-c@ics.uci.edu
>I need some help controlling colors in pixel maps and maintaining color
>fidelity when I copybits on and offscreen.
Obtain NIH Image from alw.nih.gov directory /pub/image, or elsewhere.
Look in lut.p and other files for the code used to set up the
palettes. It is not hard to find, and should be easy to translate to C.
from lut.p:
procedure UpdateLUT;
var
MaxStart, i, v, index, last: integer;
inc, sIndex: LongInt;
begin
with info^ do begin
sIndex := 0;
if ColorEnd > ColorStart then
inc := LongInt(nColors) * 10000 div (ColorEnd - ColorStart)
else
inc := 2560000;
if ColorStart < 0 then
sIndex := -ColorStart * Inc
else
sIndex := 0;
last := nColors - 1;
for i := 0 to 255 do
with cTable[i].rgb do begin
if (i < ColorStart) or (i > ColorEnd) then begin
if i < ColorStart then
cTable[i].rgb := FillColor1
else
cTable[i].rgb := FillColor2;
end
else begin
index := sIndex div 10000;
if index > last then
index := last;
Red := bsl(RedLUT[index], 8);
Green := bsl(GreenLUT[index], 8);
Blue := bsl(BlueLUT[index], 8);
sIndex := sIndex + inc;
end;
end; {for}
LoadLUT(cTable);
IdentityFunction := false;
end;
end;
from utilities.p:
procedure LoadLUT (table: MyCSpecArray);
var
i, entry, screen: integer;
cPtr: ^cSpecArray;
SaveDevice: GDHandle;
begin
if nExtraColors > 0 then begin
entry := FirstExtraColorsEntry;
for i := 1 to nExtraColors do begin
table[entry].rgb := ExtraColors[i];
entry := entry + 1;
end;
end;
for i := 1 to 254 do {Work around needed for 32-bit QuickDraw}
with table[i].rgb do
if (red = 0) and (green = 0) and (blue = 0) then begin
red := 256;
green := 256;
blue := 256;
end;
cPtr := @table[1];
SaveDevice := GetGDevice;
for screen := 1 to nMonitors do begin
SetGDevice(Monitors[screen]);
for i := 1 to 254 do begin
ProtectEntry(i, false);
ReserveEntry(i, false);
end;
SetEntries(1, 253, cPtr^);
end;
SetGDevice(SaveDevice);
end;
etc..., search for nMonitors to see where that got set up, MyCSpecArray
is defined in globals.p, etc.
--
Edward J. Huff huff@mcclb0.med.nyu.edu (212)998-8465
Keck Laboratory for Biomolecular Imaging
NYU Chemistry Deptartment, 31 Washington Place, New York NY 10003
Path: ucivax!gateway
From: pchang@cs.stanford.edu (The Weasel)
Subject: RE: random numbers
Message-ID: <9210100218.AA01798@Xenon.Stanford.EDU>
In-Reply-To: <01GPQWG1RB8I000AIJ@MCCLB0.MED.NYU.EDU>; from "Edward J. Huff" at Oct 9, 92 5:47 pm
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 32
Date: 10 Oct 92 02:19:08 GMT
Edward J. Huff writes:
>
> >CORMACK@psyvax.psy.utexas.edu writes:
> >[...]
> >I often use GetDateTime(&randSeed); in my initialization phase, and then
> >make calls to the Toolbox Random() when I need a random number.
> >[...]
> >Peter
>
> The toolbox random number generator is VERY substandard. Avoid it.
>
> I read somewhere that the Sane random number generator is supposed
> to be an implementation of the "minimal standard" described in
> CACM a few years ago, and it probably is, but I do not know that for a
> fact.
>
What makes it sub-standard? It is the linear congruential generator that
a lot generators are based on. There are better generators around, but
I would venture to say that few are as easy to implement and give as
good results.
I don't mean to be rude here, but it isn't that bad as long as you
give it a good seed.
Peter
--
Peter Chang | "My doctor says that I have a malformed
E-Mail: pchang@cs.stanford.edu | public duty gland and a natural deficiency
Snail Mail: PO Box 9603 | of moral fiber..."
Stanford, CA 94309 | Ford Prefect, HHGTTG
Path: ucivax!gateway
From: vilot@bigboy.cis.temple.edu (Tom Vilot)
Subject: RE: >32K TextEdit Class
Message-ID: <Pine.2.4.55.9210111333.A2636@bigboy.cis.temple.edu>
Newsgroups: fa.think-c
Lines: 11
Date: 11 Oct 92 17:23:14 GMT
There is a class called CPEditText which I found on America Online. I am
sure it exists on other FTP archives. If anyone can't find it, I would be
happy to email it to you.
It handles large TextEdit records, and even allows adjusting some
parameters such as tab indents and the display of invisible characters.
Pretty neat.
Tom
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: quicktime
Message-ID: <01GPU8KAMFVM8WWQBI@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 10
Date: 12 Oct 92 03:09:27 GMT
X-Envelope-to: think-c@ics.uci.edu
hi,
i want to do some quicktime stuff (don't have IM VI), so i went
down to the old ftp.apple.com. oh my the c-sample code is 2MG.
obviously they are c-bigots down there cuz the pascal sample is only 400K.
anyway the big deal is that i have a 1200 baud modem(throw fruit) and
i do not download 2MG files. why this sensless discrimination?
anyone got a simple player code or something within reason i can get.
thanks
aaron
Path: ucivax!gateway
From: de19@umail.umd.edu (Dana S Emery)
Subject: Re: >32K TextEdit Class
Message-ID: <Mailstrom.1.03b2.45168.-3114.de19@umail.umd.edu>
In-Reply-To: Your message
<Pine.2.4.55.9210111333.A2636@bigboy.cis.temple.edu> of 11 Oct 92 17:23:14
GMT
Content-Type: TEXT/plain; charset=US-ASCII
Newsgroups: fa.think-c
Lines: 16
Date: 12 Oct 92 08:32:42 GMT
As a caveat to my former post,
CPEditText is not a panacea, it assumes that all lines break only on CR, which
is appropriate for programming editors (which it was intended for), but is not
in any sense a general TE replacement.
Although CPEditText advertises display of invisible characters, it does so by
substitution with little used character codes, which is a cludge at best.
I am working on a subclass to handle wrapToFrame, wrapToPage, and
wrapToFixedColumn, and intend to post the results at the TCL-Talk archives when
I succeed.
--
dana s emery <de19@umail.umd.edu>
Path: ucivax!gateway
From: carlacio@vxcrna.cern.ch
Subject: Symantec numbers
Message-ID: <9210121622.AA11146@dxmint.cern.ch>
Newsgroups: fa.think-c
Lines: 5
Date: 12 Oct 92 16:23:35 GMT
X-Mail11-Ostype: VAX/VMS
Somebody know the FAX number of Symantec ?
Thanks.
Carlo De Vecchi.
CARLACIO@VXCERN.CERN.CH
Path: ucivax!gateway
From: huff@mcclb0.med.nyu.edu ("Edward J. Huff")
Subject: RE: random numbers
Message-ID: <01GPVESHULPU000NZ7@MCCLB0.MED.NYU.EDU>
Content-transfer-encoding: 7BIT
Newsgroups: fa.think-c
Lines: 134
Date: 12 Oct 92 23:16:22 GMT
X-Envelope-to: think-c@ics.uci.edu
Peter Chang writes:
>Edward J. Huff writes:
>>
>> >CORMACK@psyvax.psy.utexas.edu writes:
>> >[...]
>> >I often use GetDateTime(&randSeed); in my initialization phase, and then
>> >make calls to the Toolbox Random() when I need a random number.
>> >[...]
>> >Peter
>>
>> The toolbox random number generator is VERY substandard. Avoid it.
>>
>> I read somewhere that the Sane random number generator is supposed
>> to be an implementation of the "minimal standard" described in
>> CACM a few years ago, and it probably is, but I do not know that for a
>> fact.
>>
>
>What makes it sub-standard? It is the linear congruential generator that
>a lot generators are based on. There are better generators around, but
>I would venture to say that few are as easy to implement and give as
>good results.
>
>I don't mean to be rude here, but it isn't that bad as long as you
>give it a good seed.
>
>Peter
>
Here is the toolbox random number generator from a Quadra 950:
;- $A861 Random:INTEGER
82EB20: 2055 ' U' Random MOVEA.L (A5),A0
82EB22: 303C 41A7 '0<A.' MOVE #$41A7,D0
82EB26: 3400 '4.' MOVE D0,D2
82EB28: C0E8 FF84 '....' MULU -124(A0),D0
82EB2C: 2200 '".' MOVE.L D0,D1
82EB2E: 4241 'BA' CLR D1
82EB30: 4841 'HA' SWAP D1
82EB32: C4E8 FF82 '....' MULU -126(A0),D2
82EB36: D481 '..' ADD.L D1,D2
82EB38: 2202 '".' MOVE.L D2,D1
82EB3A: D281 '..' ADD.L D1,D1
82EB3C: 4241 'BA' CLR D1
82EB3E: 4841 'HA' SWAP D1
82EB40: 0280 0000 FFFF '......' ANDI.L #$FFFF,D0
82EB46: 0480 7FFF FFFF '......' SUBI.L #$7FFFFFFF,D0
82EB4C: 0282 0000 7FFF '......' ANDI.L #$7FFF,D2
82EB52: 4842 'HB' SWAP D2
82EB54: D481 '..' ADD.L D1,D2
82EB56: D082 '..' ADD.L D2,D0
82EB58: 6A06 $82EB60 BPL.S mtx_1
82EB5A: 0680 7FFF FFFF '......' ADDI.L #$7FFFFFFF,D0
82EB60: 2140 FF82 '!@..' mtx_1 MOVE.L D0,-126(A0)
82EB64: 0C40 8000 '.@..' CMPI #$8000,D0
82EB68: 6602 $82EB6C BNE.S mtx_2
82EB6A: 4240 'B@' CLR D0
82EB6C: 3F40 0004 '?@..' mtx_2 MOVE D0,4(A7)
82EB70: 4E75 'Nu' RTS
From Inside Macintosh:
pascal short Random(void)
= 0xA861;
File {CIncludes}Quickdraw.h
Inside Macintosh reference: I-194
Trap number: A861
This function returns a pseudo-random integer, uniformly distributed in the
range 32767 through 32767. The value the sequence starts from depends on
the global variable randSeed, which InitGraf initializes to 1. To start the
sequence over again from where it began, reset randSeed to 1. To start a
new sequence each time, you must reset randSeed to a random number.
Note: You can start a new sequence by storing the current date and time
in randSeed; see GetDateTime in the Operating System Utilities
chapter.
Assembly-language note: From assembly language, it's better to start a new
sequence by storing the value of the system global
variable RndSeed in randSeed.
... end IM quote...
First off, it isn't uniformly distributed, zero has twice the probablility
of occurring as any other particular value. Not such a terribly fault.
The generator returns a 16 bit value (but never -32768), but the internal
state is a 32 bit value, so that the maximum possible period is 2^32, i.e.
about 4.3 billion. No so long when you start doing some calculations.
My main complaint is that unless someone shows me that it is the minimal
standard generator (and I think it isn't, because that CACM article did not
say that the Mac generator was the minimal standard), I must assume that it
is does not meet the minimal standard. Unless you are an expert, the only
test of random numbers you should attempt is to determine whether or not a
particular generator is EXACTLY the same as a standard generator. And if
it is a linear congruential generator and is not the standard one, and was
developed before the standard came out (as is the case for the toolbox
generator), chances are very good that the generator is substantially worse
than the standard. There are a lot of AWFUL linear congruential
generators.
Sorry, I don't have the standard definition in front of me, and I would be
happy to hear that the toolbox generator IS the standard generator, but I
believe that it is not. I don't have time right now to figure out exactly
which formula that code is calculating.
The way to test a generator is described in the article. Basically, you
start the generator with a particular seed, run it enough times to force it
over the tricky part of the calculation, and verify that it gives the
correct result.
The quality of the seed has nothing to do with the quality of the
generator. A good generator gives usable numbers regardless of the seed.
One serious problem with many of these linear congruential generators is
that the low order bits of the result are not very random: if you want a
good random number between 1 and 10, you better use
(10 * (((long)Random()) + 32767)) / 65535 + 1,
rather than ((unsigned) Random()) % 10 + 1.
I have an implementation of a period 2^521 generator with a 521 bit
internal state that was described in Computing Surveys in around 1979, if
anyone is interested. It was tested by making sure that it gives the same
numbers as the published results. I don't know what its recent reputation
is.
--
Edward J. Huff huff@mcclb0.med.nyu.edu (212)998-8465
Keck Laboratory for Biomolecular Imaging
NYU Chemistry Deptartment, 31 Washington Place, New York NY 10003
Path: ucivax!gateway
From: igorl@uiuc.edu (Igor Livshits)
Subject: Underinflated balloons
Message-ID: <9210151706.AA27578@pluto.ncsa.uiuc.edu>
Newsgroups: fa.think-c
Lines: 22
Date: 15 Oct 92 17:06:27 GMT
Hello,
I am having a bizarre problem with Balloon Help:
I am using the
err = HMShowBalloon( helpData, tip, altRect, tipProc, theProc, variant, method);
call to show my balloons. All the variables are correct and contain
appropriate information to the best of my knowledge. I initialize the
helpData structure from either an 'hrct' or an 'hdlg.' Everything works
dandy with either of the string resources or a TEXT resource. The problem
occurs when my TEXT resource has 320 or more characters: HMShowBalloon
returns -50 (parameter error).
If my TEXT is 319 bytes it works, if it is 320 it breaks. Is there a
built-in limit that I am not aware of?
I would appreciate any help and clues.
Many thanks, igor
Path: ucivax!gateway
From: jim_moy@HPGRMAC.GR.HP.COM (Jim Moy)
Subject: Re: Underinflated balloons
Message-ID: <9210151922.AA28705@pluto.ncsa.uiuc.edu>
Newsgroups: fa.think-c
Lines: 39
Date: 15 Oct 92 19:24:16 GMT
Reply to:RE>Underinflated balloons
> The problem
> occurs when my TEXT resource has 320 or more characters: HMShowBalloon
> returns -50 (parameter error).
>
The following is an excerpt from a message I got from Ray Chiang at
Mac Developer Technical Support. I ran into the same problem and
asked them about it, and this is their response:
Jim Moy
jbm@gr.hp.com
-----------------------------------------------------------------------
Yes, there are a couple of work arounds that could help but not completely
resolve the problem. It sounds like you are using 'TEXT' resources for your
help messages. 'TEXT' resources are limited to about 239 characters by the
Help Mgr. (It basically works out to be close to the 17000 pixel limit.) If
it's acceptable to not have styled text, you can use 'STR#' resources instead.
The limit here is 255 characters. Not a vast improvement but one that could be
enough. If it's not acceptable and you have to have styled text, you can use a
picture of the text you want to display as a 'PICT' resource. In many cases,
using 'PICT' resources will allow for longer text but again it is not a
complete solution. Using 'PICT' resources is also more difficult to update,
localize, and maintain. You can use an application like MacDraw to create
PICTs of the text you want to display.
The Help dudes are aware of this limitation and I'm sure its on their plate of
things to enhance but for now see if either of the above suggestions will
suffice. In case you haven't looked already, there's a number of Help Mgr
related Q&A in the developer CD. Also, the Help chapter in IM volume 6
recommends that help messages be relatively short AND concise. You may want to
relay this recommendation to your learning products group. Good luck in your
continued developement and if you have additional questions, please don't
hesitate and send us another EMail. Ray.
Path: ucivax!gateway
From: abboud@cedrus.cedrus.com ("Hisham A. Abboud")
Subject: Anyone used CodeBase?
Message-ID: <9210152209.AA22200@cedrus.com>
Newsgroups: fa.think-c
Lines: 17
Date: 15 Oct 92 22:50:16 GMT
I finally located a company that has a dBase compatible C library
for the Mac. They call it a portability kit, comes with source code
that the sales rep says one can recompile on any machine.
The scary part is that the sales rep said they didn't have any
Macs in-house! He tried to reassure me by saying other clients
have recompiled it successfully on the Mac.
Would any of these "other" clients be reading this message? :-)
I was wondering if it works as advertised, and if it can read
dBase files created on the PC. Thanks,
Hisham.
Hisham A. Abboud, Cedrus Corp. [Internet: abboud@cedrus.com]
Path: ucivax!gateway
From: jmunkki@vipunen.hut.fi (Juri Munkki)
Subject: FixDiv is missing?
Message-ID: <199210171849.AA169303@vipunen.hut.fi>
Newsgroups: fa.think-c
Lines: 23
Date: 17 Oct 92 23:06:45 GMT
Why is FixDiv missing from the ToolUtils.h file in Think C 5.03?
I added it there and it works fine. Here's what I had to add:
pascal Fixed FixDiv(Fixed a,Fixed b)
= 0xA84D;
Anyway, I did this while writing a 4x4 fixed point matrix math
package. I wrote the package so that it has pure assembly language
routines for the 68000 and 68020 and C versions with toolbox calls
to make things easier to read. The idea is to use this package for
3D animation. If there is enough interest, I could make the routines
available once I have all the other necessary components done.
If anyone has a really fast and good fixed point divide for the 68000,
I would really like to see it. My current solution is probably a bit
clumsy, since it has a loop in it. The 68020 was trivial, since I could
use the divs.l <ea>,Dp:Dq instruction to do the work.
Juri Munkki
jmunkki@hut.fi
Path: ucivax!gateway
From: larry%celia.uucp@usc.edu (Larry Weinberg)
Subject: Re: FixDiv is missing?
Message-ID: <9210180727.AA15407@usc.edu>
Newsgroups: fa.think-c
Lines: 10
Date: 18 Oct 92 07:28:04 GMT
I'd definitely be interested in these routines if your making them
available. I have a 3D program that I'm trying to publish.
It's pretty fast as it is, but I'd be curious to see if your
routines would be significantly faster.
Larry
Larry Weinberg Rhythm & Hues, Inc.
INTERNET: celia!larry@usc.edu celia!larry@tis.llnl.gov
UUCP: ...{ames,hplabs}!lll-tis!celia!larry
We can't all, and some of us don't. That's all there is to it. -- Eeyore
Path: ucivax!gateway
From: phils@chaos.cs.brandeis.edu (Phil Shapiro)
Subject: FixDiv is missing?
Message-ID: <9210181905.AA18925@chaos.cs.brandeis.edu>
In-Reply-To: Juri Munkki's message of 17 Oct 92 23:06:45 GMT <199210171849.AA169303@vipunen.hut.fi>
Newsgroups: fa.think-c
Lines: 14
Date: 18 Oct 92 19:06:02 GMT
>>>>> On 17 Oct 92 23:06:45 GMT, Juri Munkki <jmunkki@vipunen.hut.fi> said:
> Why is FixDiv missing from the ToolUtils.h file in Think C 5.03?
In my copy of THINK C 5.0, it's in the FixMath.h header file. The
organization of the header files is the same as in MPW C 3.2; in
earlier versions of THINK C, the fixed-point routines were in
ToolboxUtil.h (I think).
-phil
----
Phil Shapiro Software Engineer
Language Products Group Symantec Corporation
Internet: phils@cs.brandeis.edu
Path: ucivax!gateway
From: k044477@hobbes.kzoo.edu ("Jamie R. McCarthy")
Subject: If you sent me mail...
Message-ID: <9210191304.AA13763@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 9
Date: 19 Oct 92 13:02:37 GMT
I apologize for having to do this. If you haven't sent me mail in the
last few days, please ignore this message.
Regretfully, my college computer has once again deleted my in-box
because it exceeded a certain size. If you've sent me mail since about
Sunday night, please contact me. Don't resend large (100K) letters, it
will just delete it again. Thank you.
--
Jamie McCarthy Internet: k044477@kzoo.edu AppleLink: j.mccarthy
Path: ucivax!gateway
From: djk@world.std.com (Dan J Keldsen)
Subject: subscribe djk@world.std.com
Message-ID: <CMM.0.90.2.719519722.djk@world.std.com>
Newsgroups: fa.think-c
Lines: 9
Date: 19 Oct 92 18:35:35 GMT
subscribe djk@world.std.com
--
I Have a feeling I need to be posting this to a different address, but I
don't know of any way to get that address. Here's hoping a million
people don't get this...
--
Dan Keldsen
BERKLEE College o Music - Boston, MA
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: prolog
Message-ID: <01GQ54MK9G9U8WWDIP@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 5
Date: 19 Oct 92 22:13:07 GMT
X-Envelope-to: think-c@ics.uci.edu
well this is kind of thinkc related...
does anyone know where i can find a prolog compiler thingy?
i looked through archie, but couldn't find one for mac.
thanks
Path: ucivax!gateway
From: de19@umail.umd.edu (Dana S Emery)
Subject: Re: FixDiv is missing?
Message-ID: <Mailstrom.1.03b2.61112.-3114.de19@umail.umd.edu>
In-Reply-To: Your message <9210181905.AA18925@chaos.cs.brandeis.edu> of 18
Oct 92 19:06:02 GMT
Content-Type: TEXT/plain; charset=US-ASCII
Newsgroups: fa.think-c
Lines: 16
Date: 20 Oct 92 03:01:21 GMT
>>>>> On 17 Oct 92 23:06:45 GMT, Juri Munkki <jmunkki@vipunen.hut.fi> said:
> > Why is FixDiv missing from the ToolUtils.h file in Think C 5.03?
>In my copy of THINK C 5.0, it's in the FixMath.h header file.
Phil,
If the multiple file find dialog werent such a pain to use, this user would
prably have been able to discover that for himself. The Think Pascal equivalent
shows a much more reasonable way, too bad symantecs C and Pascal people dont
seem to talk to each other enough to have allowed the best features of each
influence the other.
--
dana s emery <de19@umail.umd.edu>
Path: ucivax!gateway
From: vthrc@mailbox.uq.oz.au (Danny Thomas)
Subject: Re: prolog
Message-ID: <9210200051.aa17333@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 32
Date: 20 Oct 92 07:51:51 GMT
Aaron Barnett <C2MXBAR@fre.towson.edu> writes
>well this is kind of thinkc related...
>does anyone know where i can find a prolog compiler thingy?
>i looked through archie, but couldn't find one for mac.
the only prologs listed in the latest "Catalog of compilers, interpreters
and other language tools" posted to comp.lang.misc, comp.archives, etc are
sbcs.sunysb.edu /pub/sbprolog
swi.psy.uva.nl [192.42.96.1] ?directory?
there were several others listed, but they were all built on top of Scheme
or other Lisp. Neither of those two has a mac port listed nor is a compiler
mentioned, but the second has numerous ports to UN*X systems as well as to
MSDOS "(status unknown)". It is also said to be "actively developed" as
well as being a "very nice Ed. style prolog, best free one I've seen" so it
would be the one I'd look at first.
No FTP site is given for the list I'm quoting from and which only
includes packages for which source code is available and is intended to
serve developers rather than researchers, ie he is much more interested in
production quality systems though I'd doubt items are excluded on this
basis. Unfortunately the author of that list, David Sharnoff
"muir@tfs.com", has chosen to enforce the Free Software Foundation's boycot
of Apple, so no products are listed which exist only on the mac.. He says
to contact Zbigniew Fiedorowicz fiedorow@function.mps.ohio-state.edu for
his list.
cheers,
X500: @c=AU [I'm about to update VTHRC entries, soon...]
@o=University of Queensland
@ou=Physiology and Pharmacology Department
@ou=Vision Touch and Hearing
@cn=Danny Thomas
@rfc822Mailbox=vthrc@cc.uq.oz.au
Path: ucivax!gateway
From: ephraim@think.com (Ephraim Vishniac)
Subject: Re: prolog
Message-ID: <9210201324.AA14217@charon.think.com>
In-Reply-To: Your message of "19 Oct 92 22:13:07 GMT."
<01GQ54MK9G9U8WWDIP@TOE.TOWSON.EDU>
Newsgroups: fa.think-c
Lines: 67
Date: 20 Oct 92 13:24:23 GMT
Date: 19 Oct 92 22:13:07 GMT
From: Aaron Barnett <C2MXBAR@fre.towson.edu>
well this is kind of thinkc related...
does anyone know where i can find a prolog compiler thingy?
i looked through archie, but couldn't find one for mac.
Check the FAQ for comp.lang.prolog, also seen in news.answers.
Here's an excerpt:
Subject: comp.lang.prolog Frequently Asked Questions
Date: Wed, 26 Aug 1992 22:24:41 GMT
2. Where can I get a public-domain, free Prolog for (the IBM PC,
the Mac, Unix)?
The following are anonymous-FTP sites for free Prologs
which are either in the public domain or are "copy-lefted"
(permitted to be copied with some restrictions on commercial use).
(Please note that for extensive development work, users
will probably want a robust interpreter or compiler with good
debugging facilities and a standard syntax, among other things.
While public-domain systems are a valuable service to the
community, they do not necessarily have all these things, and
users should weigh carefully what they want to do against the
capabilities and costs of the available systems.)
For the IBM PC:
- BinProlog 1.39, anonymous FTP from clement.info.umoncton.ca
(139.103.16.2), directory BinProlog. Compiler for IBM PC 386.
E-mail: tarau@info.umoncton.ca (Paul Tarau).
- Anonymous FTP from aisun1.ai.uga.edu, directory ai.prolog;
download "Contents" first. Two systems.
E-mail: mcovingt@uga.cc.uga.edu (Michael Covington).
- SWI Prolog, anonymous FTP from swi.psy.uva.nl, file
"pub/pl-1.6.1.tar.Z"; or from ftp.th-darmstadt.de
(130.83.22.253), directory pub/programming/languages/prolog.
Portable, copy-lefted.
For the Apple Macintosh:
- Anonymous FTP from aisun1.ai.uga.edu, directory ai.prolog;
download "Contents" first.
E-mail: mcovingt@uga.cc.uga.edu (Michael Covington).
- Open Prolog, anonymous FTP from grattan.cs.tcd.ie (or
134.226.32.15), directory languages/open-prolog. In
binhex/stuffit form.
E-mail: brady@cs.tcd.ie (Michael Brady).
For Unix systems:
- BinProlog 1.39, anonymous FTP from clement.info.umoncton.ca
(139.103.16.2), directory BinProlog. Compiler for SPARC and Sun/3.
E-mail: tarau@info.umoncton.ca (Paul Tarau).
- SWI Prolog, anonymous FTP from swi.psy.uva.nl, file
"pub/pl-1.6.1.tar.Z"; or from ftp.th-darmstadt.de
(130.83.22.253), directory pub/programming/languages/prolog.
Portable, copy-lefted.
- SB-Prolog, anonymous FTP from cs.arizona.edu, directory
"sbprolog/v3". Version 3. Copy-lefted.
- Modular SB-Prolog (= SB-Prolog version 3.1 plus modules),
anonymous FTP from ftp.dcs.ed.ac.uk (129.215.160.5), file
pub/dts/mod-prolog.tar.Z . Interpreter for SPARC.
E-mail: mprolog@dcs.ed.ac.uk (Brian Paxton).
Path: ucivax!gateway
From: TPZ4@vm.cnuce.cnr.it (Rodolfo Cardarelli)
Subject: Is Unix a bad subject...?
Message-ID: <9210210341.aa18587@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 7
Date: 21 Oct 92 10:41:25 GMT
I'm a Mac user who's also a unix user. Maybe this is not the right place to
ask, but, just in case, do you know where I could find on Internet unix stuff
for HP-Apollo 7xx machines?
Thank you in advance for any help
Rodolfo Cardarelli
TPZ4@ICNUCEVM.CNUCE.CNR.IT
Path: ucivax!gateway
From: thoma@spud.kludge.com (Chris Thoma)
Subject: Stuffit/Zip/CompactPro source
Message-ID: <kkaZsB1w165w@spud.kludge.com>
Newsgroups: fa.think-c
Organization: T.T.L.F., Inc. San Francisco, CA
Lines: 10
Date: 21 Oct 92 12:16:37 GMT
I need sounce to be able to view the contents of a
Stuffit/Zip/CompactPro/LHZ archive (.sit/.cpt/.zip/.lhz). Does anyone out
there have any sourced so I can work with the above listed archive
formats. I want to be able to view the contents of the
compressed/stuffed/zipped/ect archive. I currently cant find any source.
I also would like some source for working with Packit (.pit) files. All
of the above archive formats are availble on the mac. If you have any
helpful source please mail it to me. Please I need help!
THANKS ALL!
Path: ucivax!gateway
From: dnebing@andy.bgsu.edu
Subject: Re: Stuffit/Zip/CompactPro source
Message-ID: <9210211621.AA23426@andy.bgsu.edu>
Newsgroups: fa.think-c
Lines: 38
Date: 21 Oct 92 16:22:05 GMT
>I need sounce to be able to view the contents of a
>Stuffit/Zip/CompactPro/LHZ archive (.sit/.cpt/.zip/.lhz). Does anyone out
>there have any sourced so I can work with the above listed archive
>formats. I want to be able to view the contents of the
>compressed/stuffed/zipped/ect archive. I currently cant find any source.
>I also would like some source for working with Packit (.pit) files. All
>of the above archive formats are availble on the mac. If you have any
>helpful source please mail it to me. Please I need help!
>
There was a package distributed on the net called unpack. It was
able
to unpack all of these types of files so it would be easier to download
(the
mainframes would normally be faster at unpacking the archives than a mac).
I have not checked archie, but if you look and can not find the
unpack
source, I can send you a copy if you wish.
p.s. The only problem with the source is that it was created to work on a
mainframe with unlimited memory. Some method of dealing with the
limitations
of mac memory would have to be incorporated for this program to work on a
mac.
/*
Procedure: Signature
Purpose: To print the signature file for David Nebinger
*/
void Signature(void){
printf("%s\n%s %s\n%s\n%s\n",
"Dave Nebinger",
"dnebing@andy.bgsu.edu",
"dnebing@opie.bgsu.edu",
"Just because something is said to lighten a subject,",
"doesn't mean the subject is taken lightly.");
}
Path: ucivax!gateway
From: jgarner@seattleu.edu (Jeff Garner)
Subject: GIF program or source
Message-ID: <Pine.2.2.9210211415.A15633@sumax.seattleu.edu>
In-Reply-To: <kkaZsB1w165w@spud.kludge.com>
Newsgroups: fa.think-c
Lines: 17
Date: 21 Oct 92 22:16:11 GMT
I need either of the following:
1) A GIF viewer that performs quick animations of at least a handful of
color frames, which chooses those graphic files from a list of filenames
stored in a text file (or if you support AppleEvents, that'd work too.)
2) If the above viewer doesn't exist, I would have to write one myself,
so I'd be looking for a GIF viewer source code.
This is for a weather satellite reciever project for Seattle University,
so it's NOT for commercial use... just internal to Seattle U.
Thanks,
Jeff Garner
jgarner@seattleu.edu
Path: ucivax!gateway
From: rc05@gte.com (Ramesh Chandak)
Subject: Any public domain source code available for implementing lasso
Message-ID: <9210220455.AA17755@bunny.gte.com>
Newsgroups: fa.think-c
Lines: 12
Date: 22 Oct 92 04:56:07 GMT
Hi there,
I'm trying to implement cut and copy of PICT resources. I'd like to be
able to cut part of PICTURE 1 and paste it on a at a different location
on the screen, may be on PICTURE 2 ( PICTURE 2 is at a different location
than PICTURE 1 ).
Is there any public domain source code available in C that I might be
able to use ? Any references / pointers / suggestions on how I can do
this will be much appreciated. Thanx much in advance.
- Ramesh M. Chandak
Path: ucivax!gateway
From: munroe@northstar.dmc.com (Dick Munroe)
Subject: Re: Stuffit/Zip/CompactPro source
Message-ID: <0105003C.qv5c3e@northstar.dmc.com>
Newsgroups: fa.think-c
Organization: Doyle Munroe Consultants, Inc.
Lines: 30
Date: 22 Oct 92 12:15:22 GMT
In article <kkaZsB1w165w@spud.kludge.com>, Chris Thoma <thoma@spud.kludge.com> writes:
>
> I need sounce to be able to view the contents of a
> Stuffit/Zip/CompactPro/LHZ archive (.sit/.cpt/.zip/.lhz). Does anyone out
> there have any sourced so I can work with the above listed archive
> formats. I want to be able to view the contents of the
> compressed/stuffed/zipped/ect archive. I currently cant find any source.
> I also would like some source for working with Packit (.pit) files. All
> of the above archive formats are availble on the mac. If you have any
> helpful source please mail it to me. Please I need help!
> THANKS ALL!
>
If my memory serves, sources for a U*x based critter that dealt with
most of the requested formats was posted to comp.sources.misc in the
last 12 months or so. I'm away from my office right now, so I don't
have access to my archives. I'll check more in detail when I get
back (26-Oct). If you haven't seen a post in a week, send me a reminder,
I can have a mind like a sieve.
Dick MUnroe
--
Dick Munroe Internet: munroe@dmc.com
Doyle Munroe Consultants, Inc. UUCP: ...uunet!thehulk!munroe
267 Cox St. Office: (508) 568-1618
Hudson, Ma. 01749 FAX: (508) 562-1133
GET CONNECTED!!! Send mail to info@dmc.com for details.
Path: ucivax!gateway
From: Per.Mildner@csd.uu.se (Per Mildner)
Subject: Re: GIF program or source
X-Sender: perm@meryl.csd.uu.se
Message-ID: <199210221332.AA04805@meryl.csd.uu.se>
Newsgroups: fa.think-c
X-Charset: ASCII
Lines: 13
Date: 22 Oct 92 13:32:13 GMT
X-Char-Esc: 29
At 22.16 92-10-21 +0000, Jeff Garner wrote:
>I need either of the following:
>
>1) A GIF viewer that performs quick animations of at least a handful of
>color frames, which chooses those graphic files from a list of filenames
>stored in a text file (or if you support AppleEvents, that'd work too.)
>
I'm pretty sure that (at least the commercial version of) QuickGIF can do this.
Per Mildner perm@CSD.UU.SE
Computing Science Dept. tel: +46 18 181049
Uppsala University, Sweden fax: +46 18 521270
Path: ucivax!gateway
From: JONZY@cc.utah.edu (Jonzy)
Subject: To C or not to see
Message-ID: <8069825F44016E47@CC.UTAH.EDU>
Newsgroups: fa.think-c
X-VMS-To: IN%"think-c@ics.uci.edu"
Lines: 93
Date: 22 Oct 92 20:05:32 GMT
X-Envelope-to: think-c@ics.uci.edu
Is anybody aware of a problem with MaxAppleZone() when called from
a machine that does not have this routine in ROM? I have had one
heck of a time attempting to correct a problem that is only seen
when the program runs on a machine where this routine is not in
ROM, such as an SE. The program works just fine on a CX, LC, and
SI, the only ones I have tried it on. Anyway if I comment out
the call to MaxApplZone() the program works just fine on the SE.
When debugging on an SE with the call to MaxApplZone() commented
out things work fine. If the call to MaxApplZone() is enabled,
and a stop is placed at the call to GetDefaults(), which is a routine
I defined, things are still ok. However, a Trace into GetDefaults()
freezes the cursor, and sometimes the Bomb message will appear in
the debugging window. Other times no message is displayed; regardless
the only way out is to reboot.
To summarize: main() calls InitMac() to call MaxApplZone(), get some
master pointer blocks, and initialize the toolboxes. Then main()
calls a function Initialized() which calls GetDefaults(). If I
comment out the call to MaxApplZone() things work just fine on an
SE, otherwise the program crashes in the debugger.
Any help would be greatly appreciated.
Following my signature is some sample code along with information
about the project.
-------------------------------------------------------------------------
Jonzy | jonzy@cc.utah.edu | jonzy@utahcca.bitnet
Postmaster (UUCC) | postmaster@cc.utah.edu | postmast@utahcca.bitnet
University of Utah Computer Center | (801) 581-8810
-------------------------------------------------------------------------
President UHGA (Utah Hang Gliding Association)
-------------------------------------------------------------------------
-------------------------------------------------
From a file in segment 1:
static void InitMac(numMasters)
short numMasters;
{
/* USE_SET_APPLLIMIT is undefined at this point. */
#ifdef USE_SET_APPLLIMIT
SetApplLimit((Ptr)(GetApplLimit() + 2048));
#endif USE_SET_APPLLIMIT
MaxApplZone(); /* <-- Say what? */
while (numMasters--)
MoreMasters();
InitGraf(&thePort);
InitFonts();
FlushEvents(everyEvent,0);
InitWindows();
InitMenus();
TEInit();
InitDialogs(NIL);
InitCursor();
}
main()
{
InitMac(16);
if (Initialized())
{
...
}
...
}
-------------------------------------------------
From a file in segment 6:
static void GetDefaults()
{
...
}
short Initialized()
{
GetDefaults();
...
return(true);
}
-------------------------------------------------
The following is information about the Project:
Code Data Str Jump
Segment 2 23156 4864 0 584
Segment 3 13102 1402 0 1200
Segment 4 30740 10908 0 616
Segment 5 16712 346 0 4008
Segment 6 3322 8484 0 56
Project 87590 26004 0 6576
Path: ucivax!gateway
From: ephraim@think.com (Ephraim Vishniac)
Subject: Re: To C or not to see
Message-ID: <9210231324.AA27590@charon.think.com>
In-Reply-To: Your message of "22 Oct 92 20:05:32 GMT."
<8069825F44016E47@CC.UTAH.EDU>
Newsgroups: fa.think-c
Lines: 33
Date: 23 Oct 92 13:25:10 GMT
Date: 22 Oct 92 20:05:32 GMT
From: Jonzy <JONZY@cc.utah.edu>
Is anybody aware of a problem with MaxAppleZone() when called from
a machine that does not have this routine in ROM? I have had one
heck of a time attempting to correct a problem that is only seen
when the program runs on a machine where this routine is not in
ROM, such as an SE. The program works just fine on a CX, LC, and
SI, the only ones I have tried it on. Anyway if I comment out
the call to MaxApplZone() the program works just fine on the SE.
The other thing that's different about an SE is that the default stack
is very small. Ditto on a Plus.
How much stack space does GetDefaults use? Could you be colliding with
the heap?
-------------------------------------------------
>From a file in segment 1:
static void InitMac(numMasters)
short numMasters;
{
/* USE_SET_APPLLIMIT is undefined at this point. */
#ifdef USE_SET_APPLLIMIT
SetApplLimit((Ptr)(GetApplLimit() + 2048));
#endif USE_SET_APPLLIMIT
If I understand this right, you're *reducing* your stack space by 2K
when this is included. Why? On an SE or Plus, this would leave you
with only about 2K of stack.
Path: ucivax!gateway
From: stephenm@syacus.acus.oz.au
Subject: SoundMgr Async Completion Routine (Help Pls)
Message-ID: <9210241801.647@munnari.oz.au>
Newsgroups: fa.think-c
Lines: 113
Date: 24 Oct 92 18:01:38 GMT
Hope the following code fragment can put more light on my problem.
I'm on a SE/30 with Sys7, with Tuneup 1.1.1 and MacRecorder 1.0.2 and
Think C 5.0.
I get a error (unimplemented trap) when it gets to MyCompletion callback.
Hope someone can help me with this.
--------cut here------------
#define NIL 0L
#define WNE_TRAP_NUM 0x60
#define UNIMPL_TRAP_NUM 0x9F
#define SLEEP 0L
#define REMOVE_ALL_EVENTS 0
#define NIL_MOUSE_REGION 0L
#include <SoundInput.h>
void DoMyMouseDown(EventRecord *);
pascal void MyCompletionRoutine(SPB *);
void main(void);
pascal void MyCompletionRoutine(SPB *mySPBPtr) {
OSErr osErr;
// This routine will be called when either a timeout occurs during
// recording or the SPBStopRecording is called.
// Case where the SPBStopRecording, error is set to abortErr
if (mySPBPtr->error == noErr) {
osErr=SPBRecord(mySPBPtr, TRUE);
} else
osErr=SPBCloseDevice(mySPBPtr->inRefNum);
}
void DoMyMouseDown(EventRecord *theEvent) {
OSErr osErr;
SPB *mySPBPtr;
long int myInRefNum;
pascal void MyCompletionRoutine();
mySPBPtr=(SPB *)NewPtr( sizeof(SPB) );
// After initialisation, open the Sound input device and then monitor the Event loop.
// Open the default input device for reading.
if( (osErr = SPBOpenDevice (NIL, siWritePermission, &myInRefNum)) == noErr) {
// Setup the SPB record so that the SM Record will work
mySPBPtr->inRefNum=myInRefNum;
mySPBPtr->count=1100; // number of samples recorded
mySPBPtr->milliseconds=0;
mySPBPtr->bufferLength=(long int)1100;
mySPBPtr->bufferPtr=(Ptr)NewPtr(sizeof(char)*1100);
mySPBPtr->completionRoutine=(ProcPtr)&MyCompletionRoutine;
mySPBPtr->interruptRoutine=nil;
mySPBPtr->userLong=(long int)nil;
mySPBPtr->error=noErr;
mySPBPtr->unused1=0;
osErr=SPBRecord(mySPBPtr, TRUE);
}
}
/****************
main()
*****************/
void main() {
char theChar;
Boolean WNEImplemented;
EventRecord TheEvent;
InitGraf(&thePort);
InitFonts();
FlushEvents(everyEvent, REMOVE_ALL_EVENTS);
InitWindows();
InitMenus();
TEInit();
InitDialogs(NIL);
InitCursor();
MaxApplZone();
WNEImplemented = (NGetTrapAddress(WNE_TRAP_NUM, ToolTrap) !=
NGetTrapAddress(UNIMPL_TRAP_NUM, ToolTrap));
while (TRUE) {
if(WNEImplemented)
WaitNextEvent(everyEvent, &TheEvent, SLEEP, NIL_MOUSE_REGION);
else {
SystemTask();
GetNextEvent(everyEvent, &TheEvent);
}
switch (TheEvent.what) {
case nullEvent:
break;
case mouseDown:
DoMyMouseDown(&TheEvent);
break;
default:
break;
}
}
}
--
Sincerely
Stephen McIntosh
ACUS-The Australian Centre for UNISYS software
Phone: +61-2-390-1371 | ACSnet: stephenm@syacus.OZ
Fax: +61-2-390-1391 | Internet: stephenm@syacus.OZ.AU
115 Wicks Road | UUCP: uunet!munnari!syacus.acus.oz.au!stephenm
North Ryde NSW 2113 |
AUSTRALIA |
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: OpenPict
Message-ID: <01GQDS38D8W29351SK@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 21
Date: 26 Oct 92 04:02:47 GMT
X-Envelope-to: think-c@ics.uci.edu
I'm trying to make use of some code in thinkRef to create
a picture from an area of the screen. the only problem is
that it doesn't work. Macsbug reports a bus error
@ _SetRectRgn+000C. When i use thinkCs debbuger the bus
error happens at OpenPicture and Macsbug reports it @
_PutPicOP+01D4. I'm clueless.
here it is:
Rect picRect;
PicHandle thePic;
ClipRect ( & thePort -> portRect );
SetRect ( &picRect, 0,0,100,100 );
thePic = OpenPicture ( &picRect );
CopyBits ( & thePort -> portBits , & thePort -> portBits ,
&picRect, &picRect, srcCopy , 0L );
ClosePicture ();
thanks
aaron
Path: ucivax!gateway
From: ag757@yfn.ysu.edu (Ian Clysdale)
Subject: Subscription
Message-ID: <199210260420.AA18214@yfn.ysu.edu>
Newsgroups: fa.think-c
Reply-To: ag757@yfn.ysu.edu
Lines: 14
Date: 26 Oct 92 04:21:12 GMT
Hello all. I know that this is probably poor protocol, but cna
you please send me the instructions on how to subscribe for this
list? I've been trying to work out the listserv code on my own,
but don't really know what it is.
Thanks a lot.
--
Ian Clysdale
Student and Official Nobody
Internet: ag757@yfn.ysu.edu
Fidonet: Ian Clysdale, 1:163/241
Path: ucivax!gateway
From: k059509@hobbes.kzoo.edu ("Jason A. Bobier")
Subject: problems with think c
Message-ID: <9210260645.AA07894@hobbes.kzoo.edu>
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 17
Date: 26 Oct 92 06:43:15 GMT
I am having problems with think c, which may be a bug. Often times when I
recompile a project, I get a project requires larger memory partition error.
This happens on projects that clearly have enough memory allocated to them.
When this happens, I have to remove the object code and recompile. It's really
a pain as it tends to happen about one in every three times I compile a
project.
I am using think c 5.03 and CMaster 1.9.
I have tried reinstalling both of these, but it didn't seem to help.
Does anyone else have this problem, and if so how do I solve it. Help!!!
Jason Bobier
k059509@kzoo.edu
According to the Hitchiker's Guide to the Galaxy, in order to fly one must
simply throw themselves at the ground and miss.
Path: ucivax!gateway
From: ephraim@think.com (Ephraim Vishniac)
Subject: Re: Subscription
Message-ID: <9210261410.AA04535@charon.think.com>
In-Reply-To: Your message of "26 Oct 92 04:21:12 GMT."
<199210260420.AA18214@yfn.ysu.edu>
Newsgroups: fa.think-c
Lines: 12
Date: 26 Oct 92 14:10:57 GMT
Date: 26 Oct 92 04:21:12 GMT
From: Ian Clysdale <ag757@yfn.ysu.edu>
Hello all. I know that this is probably poor protocol, but cna
you please send me the instructions on how to subscribe for this
list? I've been trying to work out the listserv code on my own,
but don't really know what it is.
Send administrative requests to think-c-request@ics.uci.edu. This is a
general rule which works for 99% of the net mailing lists -- requests
for list foo@bar go to foo-request@bar.
Path: ucivax!gateway
From: JONZY@cc.utah.edu (Jonzy)
Subject: Follow up on: To C or not to see
Message-ID: <C3D44FCEE2022868@CC.UTAH.EDU>
Newsgroups: fa.think-c
X-VMS-To: IN%"think-c@ics.uci.edu"
Lines: 93
Date: 26 Oct 92 21:33:06 GMT
X-Envelope-to: think-c@ics.uci.edu
With my posting last week concerning a problem with a call to MaxApplZone(),
I have not only found the problem, but a correction as well. The problem
was the stack space was not big enough. On an SE the initial stack space
is around 6k, while on an SI it is about 24k.
I must thank Steve Dorner for enlightening me to the problem.
Following my signature is some source to remedie the problem.
-------------------------------------------------------------------------
Jonzy | jonzy@cc.utah.edu | jonzy@utahcca.bitnet
Postmaster (UUCC) | postmaster@cc.utah.edu | postmast@utahcca.bitnet
University of Utah Computer Center | (801) 581-8810
-------------------------------------------------------------------------
President UHGA (Utah Hang Gliding Association)
-------------------------------------------------------------------------
/*****************************************************************************
* InitializeStackHeapAndMac makes sure the stack space is at least
* 'stackSpace' size, expands the applications heap to limit, acquires
* 'numMasters' number of master pointer blocks, and finaly initializes
* the toolboxes. The variable 'memoryNeeds' is the sum of master pointer
* blocks, which is 'numMasters' * the number of master pointers per block *
* the size of a master pointer + stackSpace + a safety buffer. The safety
* buffer I use here is 5k. I should mention that no application code is
* included in the value of 'memoryNeeds'. If the 'memoryNeeds' is greater
* than what is available this routine just toots the horn and bails out.
* Page 475 of Think C User Manual incorrectly calls MaxApplZone() after
* initializing the toolboxes. Inside Macintosh Volumn II, page 26 says to
* call MaxApplZone(), initialize QuickDraw and then the Window Manager.
* Note: This routine must exist in the same segment as main, otherwise
* you will loose all your master pointer blocks.
****************************************************************************/
static void InitializeStackHeapAndMac(numMasters,stackSpace)
int numMasters; /* The number of Master Pointer Blocks. */
long stackSpace; /* The heap stack size. */
{ short bailOut = 0; /* Do we have the required memory? */
long memoryNeeds; /* The heap + stack + safetyBuffer. */
memoryNeeds = numMasters * 64 * 4 + stackSpace + 5 * 1024;
if (!(bailOut = (memoryNeeds > ((long)CurStackBase - (long)ApplZone))))
{
/* See if we need to increase the stack size. */
if ((CurStackBase - ApplLimit) < stackSpace)
SetApplLimit(CurStackBase - stackSpace);
/* Expand the application heap zone to its limit. */
MaxApplZone();
/* Each call to MoreMasters() will allocate a block of 64 *
* master pointers, where each master pointer is 4 bytes. */
while (numMasters--)
MoreMasters();
}
/* Initialize the various toolboxes in the proper order. */
InitGraf(&thePort);
InitFonts();
InitWindows();
InitMenus();
TEInit();
InitDialogs(NIL);
InitCursor();
/* Now discard all events except a disk inserted event. */
FlushEvents(everyEvent - diskMask,0);
if (bailOut)
{ /* Should really bring up a dialog and tell */
SysBeep(1); /* the user they are a geek for changing */
ExitToShell(); /* the applications required size. */
}
} /* InitializeStackHeapAndMac */
/*****************************************************************************
* main is the first routine to get called by the system.
****************************************************************************/
main()
{
InitializeStackHeapAndMac(16,(long)(24 * 1024));
if (Initialized())
{
UnloadSeg(Initialized);
while (MainEventLoop())
/* Get on with the program. */;
}
} /* main */
/****************************************************************************/
Path: ucivax!gateway
From: de19@umail.umd.edu (Dana S Emery)
Subject: Re: problems with think c
Message-ID: <Mailstrom.1.03b2.24567.15089.de19@umail.umd.edu>
In-Reply-To: Your message <9210260645.AA07894@hobbes.kzoo.edu> of 26 Oct 92
06:43:15 GMT
Content-Type: TEXT/plain; charset=US-ASCII
Newsgroups: fa.think-c
Lines: 14
Date: 27 Oct 92 07:55:01 GMT
I have seen strange linking problems and other anomolous behaviour with project
files ported to 5.0.3 from earlier versions.
Symantec has been unable to replicate this behaviour, and it may be unrelated to
your troubles.
For me, the fix has been to recreate the project file in 5.0.3 from scratch,
which is even more obnoxious than simply removing object code, as one has to
re-add all source files, and establish equivalent options settings.
Again, this is not an acknowledged bug, your milage may differ.
--
dana s emery <de19@umail.umd.edu>
Path: ucivax!gateway
From: iom@dsunx1.dsrd.ornl.gov (MIKOLIC-TORREI I)
Subject: Formats for reading dBase files requested
Message-ID: <9210282314.AA22296@dsunx1.DSRD.ORNL.GOV>
Newsgroups: fa.think-c
Lines: 20
Date: 28 Oct 92 23:15:53 GMT
I need to but together a small library to open and read (i.e., extract
various fields from various records) dBase files originally created on a
DOS machine (the *.DBF files).
I need to be able to read the header to figure out the data file. I can
hack this by looking at the DBF files I have handy, but I would much rather
have an actual description of how the header is built to be sure I'm
allowing for all possible cases/sizes etc.
My question: can anybody send me a description or point me to where I
could find one (be it an Internet archive reference or an old fashioned
library reference--you now, the kind with title, author, and they're too
big to fit in the little slot for the disk drive... :)
Thanks,
Igor Mikolic-Torreira
iom@dsunx1.dsrd.ornl.gov
Path: ucivax!gateway
From: dnebing@andy.bgsu.edu
Subject: CStdPopupPanes and DLOGs...
Message-ID: <9210290213.AA10045@andy.bgsu.edu>
Newsgroups: fa.think-c
Lines: 32
Date: 29 Oct 92 02:14:02 GMT
I am working on adding some popups to a program using the Think
Class Library. Following the NewClassDemo as an example, I set up a
DLOG, DITL, and StdP resources. I copied the DoDemoDialog function
word for word into my own program.
When I run the program and display the dialog, the
CStdPopupPane appears correct. But when I click on the pane, nothing
happens. I traced through the code, following how the DLOG and DITL
were loaded and entered, and this seems to work fine. But the clicks
are not getting sent to the CStdPopupPane::DoClick routine. I double
and triple checked everything, but have failed to find the answer.
Can anyone offer a hint???
dnebing@andy.bgsu.edu
/*
Procedure: Signature
Purpose: To print the signature file for David Nebinger
*/
void Signature(void){
printf("%s\n%s %s\n%s\n%s\n",
"Dave Nebinger",
"dnebing@andy.bgsu.edu",
"dnebing@opie.bgsu.edu",
"Just because something is said to lighten a subject,",
"doesn't mean the subject is taken lightly.");
}
Path: ucivax!gateway
From: iron@imag.fr (Francois Menneteau)
Subject: Re: CStdPopupPanes and DLOGs...
Message-ID: <9210291228.AA27337@imag.imag.fr>
In-Reply-To: dnebing@andy.bgsu.edu's message as of Oct 29, 2:14.
Newsgroups: fa.think-c
Organization: IMAG Institute, University of Grenoble, France
Lines: 32
Date: 29 Oct 92 12:29:14 GMT
[29 Oct]. In your message you write:
>
> I am working on adding some popups to a program using the Think
> Class Library. Following the NewClassDemo as an example, I set up a
> DLOG, DITL, and StdP resources. I copied the DoDemoDialog function
> word for word into my own program.
>
> When I run the program and display the dialog, the
> CStdPopupPane appears correct. But when I click on the pane, nothing
> happens. I traced through the code, following how the DLOG and DITL
> were loaded and entered, and this seems to work fine. But the clicks
> are not getting sent to the CStdPopupPane::DoClick routine. I double
> and triple checked everything, but have failed to find the answer.
> Can anyone offer a hint???
>
> dnebing@andy.bgsu.edu
>
I had the same the problem, but found the solution : the menu ID was
different from the menu resource ID. Once I correct this, it works perfectly
Hope it helps.
PS: I try to use hierarchical menu with the CStdPopupPane, but it does not
work : the hierarchical menus only come disabled!!!
HELP...
--
Francois Menneteau () __|||||__ () "... I had their lives in my hands
================== () /O O\ () their fate their fortune in my visions
iron@imag.fr () - .|. - () No one believed in my true prophecy
================== () \=^=/ () And now it's too late." (Iron Maiden)
Path: ucivax!gateway
From: jhusk@silver.ucs.indiana.edu ("Joseph G. Husk")
Subject: MBAR
Message-ID: <9210281531.aa04329@q2.ics.uci.edu>
X-Mailer: ELM [version 2.4 PL0]
Content-Type: text
Content-Length: 735
Newsgroups: fa.think-c
Lines: 27
Date: 29 Oct 92 17:10:57 GMT
I've a question pertaining to Think C. I can send you my
Think C Serial number if you wish.
I've created a program and when it's running in the background
my Menu Bar bleeds through to the front running application
every once in a click so to speak... why ?
MenuBarInit()
{
Handle myMenuBar;
myMenuBar = GetNewMBar(BASE_RES_ID);
SetMenuBar(myMenuBar);
gAppleMenu = GetMHandle(APPLE_MENU_ID);
AddResMenu(gAppleMenu, 'DRVR');
gFileMenu = GetMHandle(FILE_MENU_ID);
gMiscMenu = GetMHandle(MISC_MENU_ID);
DrawMenuBar();
}
Simple enough, but I can't figure out why when I'm in another program
and mine is in the background why my menu bar will sometimes show
through?
-Joe Husk
Ucs Macintosh Consultant
Indiana University
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: launch by file
Message-ID: <01GQIUSO0VIQ935HFC@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 4
Date: 29 Oct 92 19:08:02 GMT
X-Envelope-to: think-c@ics.uci.edu
how can i check to see if my app has been launched by the user opening
its file, so that i can open it(them).
aaron
Path: ucivax!gateway
From: C2MXBAR@fre.towson.edu (Aaron Barnett)
Subject: Apple Thought Police
Message-ID: <01GQIY06ZQHE935POA@TOE.TOWSON.EDU>
Content-transfer-encoding: 7BIT
MIME-version: 1.0
Newsgroups: fa.think-c
X-VMS-To: TOE::IN%"think-c@ics.uci.edu"
Lines: 6
Date: 29 Oct 92 20:41:53 GMT
X-Envelope-to: think-c@ics.uci.edu
I want to do something _undocumented_ (shhhhh).
I want to make a Dialog Window that has an itemlist defined in my
program (not in a 'DITL' resource). its kind of important that i do it
this way. has anyone figured this one out.
Mr. X
Path: ucivax!gateway
From: swenson%john.Berkeley.EDU@ucbvax.berkeley.edu (Kirk Swenson)
Subject: Re: Creating dialog item lists
Message-ID: <9210300001.AA25962@john.berkeley.edu>
Newsgroups: fa.think-c
Lines: 22
Date: 30 Oct 92 00:08:06 GMT
Aaron Barnett <C2MXBAR@fre.towson.edu> writes:
>I want to do something _undocumented_ (shhhhh).
>I want to make a Dialog Window that has an itemlist defined in my
>program (not in a 'DITL' resource). its kind of important that i do it
>this way. has anyone figured this one out.
>
>Mr. X
There's nothing undocumented about it. First, you create the item list
following the format for the DITL resource (IM I-427) in a handle. Then
you pass the handle to NewDialog (IM I-412) as the "items" parameter. The
description of the NewDialog routine even tells you that you're allowed to
create your own item list. The TCL dialog routines do the inverse process
(read the DITL resource and extract the individual items) to figure out
what panes to create for the dialog. Along the way, they define structures
for manipulating item lists which might be useful to you.
Kirk Swenson
UC Berkeley
swenson@john.berkeley.edu
Path: ucivax!gateway
From: C511899@mizzou1.missouri.edu (Andrew McAllister)
Subject: Think Reference
Message-ID: <9210291615.aa16539@q2.ics.uci.edu>
Newsgroups: fa.think-c
Lines: 7
Date: 30 Oct 92 00:15:51 GMT
Howdy world.
I saw an ad in MacWeek the other day. And much to my surprise there was
a listing for Think Reference. BUT! It was described as if it contained
information for Vol 6 of Inside Macintosh. Could this be true? Did symantec
actually release a usefull reference for all of us sys 7 programmers?
andy
c511899@mizzou1.missouri.edu
Path: ucivax!gateway
From: gurgle@netcom.com (Pete Gontier)
Subject: Re: Apple Thought Police
Message-ID: <9210300317.AA22392@netcom.netcom.com>
In-Reply-To: <01GQIY06ZQHE935POA@TOE.TOWSON.EDU>; from "Aaron Barnett" at Oct 29, 92 8:41 pm
X-Mailer: ELM [version 2.3 PL11]
Newsgroups: fa.think-c
Lines: 40
Date: 30 Oct 92 03:20:41 GMT
> I want to do something _undocumented_ (shhhhh).
> I want to make a Dialog Window that has an itemlist defined in my
> program (not in a 'DITL' resource). its kind of important that i do it
> this way. has anyone figured this one out.
You could always use the new AppendDITL calls in System 7, of
course. I've done it this-a-way before:
Use ResEdit (or preferably Resorcerer) to edit your DITL as usual.
When you're done, open the DITL with the hex editor. Grab the hex
text and copy it to the clipboard. Jump over to your editor and
paste it in. Break it up into chunks of less-than 255 characters.
Declare strings, or perhaps an array of strings, for the chunks
of hex and enquote them.
Now, the tricky part. Find out the size of the DITL. Total the
lengths of all the strings. Divide by 2. (In ASCII hex, each byte
is represented by two characters (bytes)). Allocate a handle
using the size. Use StuffHex to stick each string into the handle
end-to-end. Zing, instant DITL. Pass it to NewDialog.
You can eliminate the strings out of the DITL to make the text
mangling less arduous and then string-ize the dialog at runtime
with code if that's a trade-off you're happy with.
I'm rather proud of this hack. Someone should enshrine it. I only
wish I could put arbitrary binary data in a (probably string)
constant -- that would eliminate all the StuffHex'ing. Probably
it's worth writing a program that takes an arbitrary resource
and converts it to a declaration of an array of byte values:
static unsigned char gHackDITL[ ] =
{
0xF5, 0x5F ...
};
Come to think of it, DeRez output can look a lot like this...
--
Pete Gontier // EC Technology // gurgle@netcom.com
Path: ucivax!gateway
From: vilot@bigboy.cis.temple.edu (Tom Vilot)
Subject: Re: CStdPopupPanes and DLOGs...
Message-ID: <Pine.2.4.55.9210300758.D4273@bigboy.cis.temple.edu>
In-Reply-To: <9210290213.AA10045@andy.bgsu.edu>
Newsgroups: fa.think-c
Lines: 26
Date: 30 Oct 92 07:42:53 GMT
On 29 Oct 1992, dnebing@andy.bgsu.edu wrote:
> I am working on adding some popups to a program using the Think
> Class Library. Following the NewClassDemo as an example, I set up a
> DLOG, DITL, and StdP resources. I copied the DoDemoDialog function
> word for word into my own program.
>
> When I run the program and display the dialog, the
> CStdPopupPane appears correct. But when I click on the pane, nothing
> happens. I traced through the code, following how the DLOG and DITL
> were loaded and entered, and this seems to work fine. But the clicks
> are not getting sent to the CStdPopupPane::DoClick routine. I double
> and triple checked everything, but have failed to find the answer.
> Can anyone offer a hint???
>
> dnebing@andy.bgsu.edu
This may sound silly, you may have already checked it, and it may be
obvious. But, are you sure you checked the "WantsClicks" instance in the
resource? I find this quite an annoying attribute of most of the TCL view
subclasses. CButton, for example, defaults to WantsClicks = FALSE. What a
pain. You may also have to tell your MainPane that it wants clicks.
Tom
Path: ucivax!gateway
From: SCHENKL@vax.cs.hscsyr.edu
Subject: RE: launch by file
Message-ID: <921029180756.20202a27@vax.cs.hscsyr.edu>
Newsgroups: fa.think-c
Lines: 12
Date: 30 Oct 92 16:23:12 GMT
X-Vmsmail-To: SMTP%"fa.think-c-outbound-request@ics.uci.edu"
Install an apple event handler for the type odoc. There is also the
[archiac] routine(s) that are something like "CountFiles" or the like.
Hope this helps...
(Whops... here's more correct info:
CountAppFiles();
GetAppFiles();
ClrAppFiles();
Or the apple event 'odoc' event.)
Path: ucivax!gateway
From: dnebing@andy.bgsu.edu
Subject: CStdPopupPane and DLOGs revisited
Message-ID: <9210301715.AA06996@andy.bgsu.edu>
Newsgroups: fa.think-c
Lines: 32
Date: 30 Oct 92 17:15:37 GMT
Thanks to all of those that have answered, with your help I have
found
the problem. I was using a user item to create a border around a group of
CStdPopupPanes. This item was not enabled.
I changed the resource so that it was enabled, and now it works
perfectly.
One final question: One of my CStdPopupPanes is for choosing a
font.
How do you set the initial value of the popup so that the font that is
currently
selected is the font showing in the popup?
dnebing@andy.bgsu.edu
/*
Procedure: Signature
Purpose: To print the signature file for David Nebinger
*/
void Signature(void){
printf("%s\n%s %s\n%s\n%s\n",
"Dave Nebinger",
"dnebing@andy.bgsu.edu",
"dnebing@opie.bgsu.edu",
"Just because something is said to lighten a subject,",
"doesn't mean the subject is taken lightly.");
}
Path: ucivax!gateway
From: asaria@rrdtc.donnelley.com
Subject: TextEdit >32K
Message-ID: <9210301739.AA09853@uu.psi.com>
Newsgroups: fa.think-c
Lines: 13
Date: 30 Oct 92 18:05:37 GMT
Hello,
I'm looking for sample code that manages >32K edit buffers for use with
TextEdit. A TCL class (CPEditText) was discussed on this list a while ago,
does anyone have ideas (or code) on how to do this in non-TCL C?
I'd appreciate any information you can provide.
Thanks,
Riyaz
asaria@donnelley.com